package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernateLastChangeVO;

/**
 * OrderBankGroup entity. @author MyEclipse Persistence Tools <b><i>powered by
 * Belev</i></b>
 */
@Entity
@Table(name = "order_groups")
@GeneratorKey(tableName = "order_groups")
public class OrderGroupVO extends HibernateLastChangeVO {

	private static final long serialVersionUID = -6288083399375559433L;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "employee_id", nullable = false)
	private EmployeeVO employee;

	@Column(name = "event_time", nullable = false, length = 23)
	private Date eventTime;

	@Column(name = "file_name", length = 100)
	private String fileName;

	/** датата на последна промяна на обекта */
	@Column(name = "last_change", nullable = false, length = 23)
	private Date lastChange;

	@Column(name = "locked", nullable = false)
	private boolean locked;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_order_group_type_id", nullable = false)
	private NomOrderGroupTypeVO nomOrderGroupType;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "orderBankGroup")
	private List<OrderBankPaymentVO> orderBankPayments;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderBankGroup")
	private List<OrderServiceVO> orderServices;

	/** default constructor */
	public OrderGroupVO() {
		this.orderServices = new ArrayList<OrderServiceVO>();
		this.orderBankPayments = new ArrayList<OrderBankPaymentVO>();
	}

	/** @return the employee */
	public EmployeeVO getEmployee() {
		return this.employee;
	}

	/** @return the eventTime */
	public Date getEventTime() {
		return this.eventTime;
	}

	/** @return the fileName */
	public String getFileName() {
		return this.fileName;
	}

	/** @return the lastChange */
	@Override
	public Date getLastChange() {
		return this.lastChange;
	}

	/** @return the nomOrderGroupType */
	public NomOrderGroupTypeVO getNomOrderGroupType() {
		return this.nomOrderGroupType;
	}

	/** @return the orderBankPayments */
	public List<OrderBankPaymentVO> getOrderBankPayments() {
		return this.orderBankPayments;
	}

	/** @return the orderServices */
	public List<OrderServiceVO> getOrderServices() {
		return this.orderServices;
	}

	/** @return the locked */
	public boolean isLocked() {
		return this.locked;
	}

	/** @param employee */
	public void setEmployee(EmployeeVO employee) {
		this.employee = employee;
	}

	/** @param eventTime */
	public void setEventTime(Date eventTime) {
		this.eventTime = eventTime;
	}

	/** @param fileName */
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	/** @param lastChange */
	@Override
	public void setLastChange(Date lastChange) {
		this.lastChange = lastChange;
	}

	/** @param locked */
	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	/** @param nomOrderGroupType */
	public void setNomOrderGroupType(NomOrderGroupTypeVO nomOrderGroupType) {
		this.nomOrderGroupType = nomOrderGroupType;
	}

	/** @param orderBankPayments */
	public void setOrderBankPayments(List<OrderBankPaymentVO> orderBankPayments) {
		this.orderBankPayments = orderBankPayments;
	}

	/** @param orderServices */
	public void setOrderServices(List<OrderServiceVO> orderServices) {
		this.orderServices = orderServices;
	}
}